package com.swq.java.code.chapter09.code05;

import com.swq.java.code.chapter09.code03.CarWrongException;

import java.util.Random;

/**
 * @author xi.yang
 * @create 2019-05-15 20:18
 **/
public class Car {
    public void run() throws CarWrongException {
        final int i = new Random().nextInt(100);
        if (i > 80) {
            throw new CarWrongException("车子刹车坏了");
        }
        if (i > 60) {
            throw new CarWrongException("发动机无法启动");
        }
    }
}
